package util

import (
	"path"
	"runtime"
)

func GetCallerInfo(skip int) (fileName string, line int, funcName string) {
	pc, fileName, line, ok := runtime.Caller(skip)
	if !ok {
		return
	}
	fileName = path.Base(fileName)          // 从fileName(文件全路径)中剥离文件名
	funcName = runtime.FuncForPC(pc).Name() // 根据pc拿到函数名
	funcName = path.Base(funcName)
	return
}
